import {solutionMethod} from '@/utils/models/solution.js'
const crudMethod = new solutionMethod();
import {homeMethod} from '@/utils/models/index.js'
const indexMethod = new homeMethod();
import Footer from '@/components/footer-main'
export default {
  name: 'Home',
  components: { Footer},
  data() {
    return {
      solutionLoad: false,
      solutionData: [],
      bannerData: []
    }
  },
  created() {
    document.title = '朔悦科技'
    this.getCmfBanner()
    // this.getDictionarys()
    this.getSolutions()
  },
  methods: {
    getDictionarys() {
      let _this = this
      indexMethod.getDictionary('朔悦产品').then((res) => {
        let {msg, code, data} = res;
        _this.dictionaryData = data.data
      })
    },
    getCmfBanner () {
      let _this = this
      _this.bannerData = []
      indexMethod.frontCmfBanner(3).then((res) => {
        let {msg, code, data} = res;
        data.data.forEach(item => {
          item.bannerImg = item.bannerImg ? _this.baseURL + item.bannerImg : ''
        })
        _this.bannerData = data.data
      })
    },
    // 解决方案
    getSolutions () {
      let _this = this
      _this.solutionLoad = true
      crudMethod.getSolution().then((res) => {
        _this.solutionLoad = false
        let {msg, code, data} = res;
        data.data.forEach(item => {
          item.solutionMinImg = item.solutionMinImg ? _this.baseURL + item.solutionMinImg : ''
          item.solutionSilhouetteImg = item.solutionSilhouetteImg ? _this.baseURL + item.solutionSilhouetteImg : ''
          item.solutionMinSilhouetteImg = item.solutionMinSilhouetteImg ? item.solutionMinSilhouetteImg.split(',') : []
        })
        _this.solutionData = data.data
      })
    },
  }
}
